<template>
<div class='pages-container'>
    <div class='pageLayout-container'>
        <i class='goHome icon' v-if='layout.showHome' @click='handleBack(1)'></i>
        <i class='goBack icon' v-if='layout.showBack' @click='handleBack(2)'></i>
        <span class='title'>{{layout.title}}</span>
    </div>
    <main>
        <router-view></router-view>
    </main>
</div>
</template>

<script>
  import {mapGetters} from 'vuex' 
  export default {
    data () {
      return {
      };
    },
    computed:{
        ...mapGetters({layout:'common/getLayout'})
    },
    methods:{
        handleBack(type){
            if(type===1){
                this.$router.push('/home').catch(()=>{})
            }else if(type===2){
                this.$router.back()
            }
        }
    }
  }

</script>
<style scoped lang='less'>
    @import '../style/layout.less';
</style>